package com.asynctm.android.tm.activity;

import android.app.Activity;
import android.content.Context;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ListView;
import android.widget.ViewFlipper;

import com.asynctm.android.R;

/**
 * Guarda las referencias que apuntan a la pantalla de seleccion de tareas
 * 
 * @author rockdrigo
 */
public class TaskManagerActivityViewHolder {

	private ViewFlipper viewFlipper;

	private Button btnHomework;
	private Button btnJourney;
	private Button btnAnniversary;
	private Button btnBirthday;
	private Button btnReminder;
	private Button btnNotes;

	private ListView listView;
	private Button btnAdd;

	/**
	 * 
	 * @param activity
	 */
	public TaskManagerActivityViewHolder(Activity activity) {
		this.viewFlipper = (ViewFlipper) activity
				.findViewById(R.id.viewFlipperActivityQuery);

		this.btnHomework = (Button) activity.findViewById(R.id.btnHomework);
		this.btnJourney = (Button) activity.findViewById(R.id.btnJourney);
		this.btnAnniversary = (Button) activity
				.findViewById(R.id.btnAnniversary);
		this.btnBirthday = (Button) activity.findViewById(R.id.btnBirthday);
		this.btnReminder = (Button) activity.findViewById(R.id.btnReminder);
		this.btnNotes = (Button) activity.findViewById(R.id.btnNotes);

		this.listView = (ListView) activity.findViewById(R.id.basicList);
		this.btnAdd = (Button) activity.findViewById(R.id.btnAddAct);
	}

	public ViewFlipper getViewFlipper() {
		return viewFlipper;
	}
	
	public ListView getListView() {
		return listView;
	}

	public Button getBtnHomework() {
		return btnHomework;
	}

	public Button getBtnJourney() {
		return btnJourney;
	}

	public Button getBtnAnniversary() {
		return btnAnniversary;
	}

	public Button getBtnBirthday() {
		return btnBirthday;
	}

	public Button getBtnReminder() {
		return btnReminder;
	}

	public Button getBtnNotes() {
		return btnNotes;
	}

	public Button getBtnAdd() {
		return btnAdd;
	}

	/**
	 * Implemente un {@link OnClickListener} a los botones de la actividad
	 * 
	 * @param clickListener
	 */
	public void setOnClickListener(OnClickListener clickListener) {
		this.btnHomework.setOnClickListener(clickListener);
		this.btnJourney.setOnClickListener(clickListener);
		this.btnAnniversary.setOnClickListener(clickListener);
		this.btnBirthday.setOnClickListener(clickListener);
		this.btnReminder.setOnClickListener(clickListener);
		this.btnNotes.setOnClickListener(clickListener);

		this.getBtnAdd().setOnClickListener(clickListener);
	}

	/**
	 * Genera la lista de actividades
	 * 
	 * @param activities
	 */
	public void populateMovements(Context context) {
		listView.setAdapter(new ActivitiesListAdapter(context));
	}

}
